<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<!DOCTYPE html>
<html>
<head>
    <title>账册同步</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <%@include file="/WEB-INF/pages/common/taglib.jsp" %>
    <%@include file="/WEB-INF/pages/common/common.jsp" %>
    <script type="text/javascript" src="${basePath}/js/ecommerce.js"></script>
    <style type="text/css">

        tbody {
            border: solid #ccc 1px;
            width: 100%;
        }

        .table1 tr {
            border: solid #ccc 1px;
            width: 100%;
        }

        .table1 tr th {
            min-width: 100px;
            width: auto;
        }

        .table1 tr td input {
            width: 100%;
        }

    </style>
</head>
<body>
<div class="content content_frame">
    <h3 class="mainTitle"><img src="${basePath}/images/icon2.png"/>同步电子账册</h3>
    </br>
    <ul class="contentNav dib-wrap">
        <li class="dib" id="btnSearch" defaultkey='13' onclick="reloadGrid()">
            <a><i class='fa fa-search'></i>&nbsp;&nbsp;查&nbsp;询 </a>
        </li>
        <li class="dib ">
            <a onclick="ClearAllInput('SearchTable')">
                <i class='fa fa-refresh'></i>&nbsp;&nbsp;重&nbsp;置 </a>
        </li>
    </ul>
    <br/>
    <form id="SearchTable">
        <table class="table1" style="display: block">
            <tbody>
            <tr>
                <th>经营单位代码</th>
                <td width="400">
                    <input type="text" placeholder="经营单位代码" datafield="SearchTable.entCode">
                </td>
                <th>经营单位名称</th>
                <td width="400">
                    <input type="text" placeholder="经营单位名称" datafield="SearchTable.entName">
                </td>
                <th>账册编号</th>
                <td width="400">
                    <input type="text" placeholder="账册编号" datafield="SearchTable.bookNo">
                </td>
                <th>企业内部编号</th>
                <td width="400">
                    <input type="text" placeholder="企业内部编号" datafield="SearchTable.innerEntCode">
                </td>
            </tr>
            <tr>
                <th>录入日期</th>
                <td width="400">
                    <input type="text" placeholder="起始日期" class="Wdate"
                           onclick="WdatePicker({dateFmt:'yyyy-MM-dd',maxDate:'#F{$dp.$D(\'recordTimeEnd\')}'})"
                           timeformat="YYYY-MM-DD HH:MM:SS" id="recordTimeStart"
                           datafield="SearchTable.recordTimeStart">
                </td>
                <th>至</th>
                <td width="400">
                    <input type="text" placeholder="结束日期" class="Wdate"
                           onclick="WdatePicker({dateFmt:'yyyy-MM-dd',minDate:'#F{$dp.$D(\'recordTimeStart\')}'})"
                           timeformat="YYYY-MM-DD HH:MM:SS" id="recordTimeEnd"
                           datafield="SearchTable.recordTimeEnd">
                </td>
                <th>申报日期</th>
                <td width="400">
                    <input type="text" placeholder="起始日期"
                           onclick="WdatePicker({dateFmt:'yyyy-MM-dd',maxDate:'#F{$dp.$D(\'decTimeEnd\')}'})"
                           timeformat="YYYY-MM-DD HH:MM:SS" id="decTimeStart"
                           datafield="SearchTable.decTimeStart">
                </td>
                <th>至</th>
                <td width="400">
                    <input type="text" placeholder="结束日期" class="Wdate"
                           onclick="WdatePicker({dateFmt:'yyyy-MM-dd',minDate:'#F{$dp.$D(\'decTimeStart\')}'})"
                           timeformat="YYYY-MM-DD HH:MM:SS" id="decTimeEnd"
                           datafield="SearchTable.decTimeEnd">
                </td>
            </tr>
            </tbody>
        </table>
    </form>
    <div class="cl"></div>
    <br/>

    <div class='responsive-table'>
        <table id="corptable" style="height: 1px">
        </table>
        <div id="corptablePage">
        </div>
    </div>
</div>
<script type="text/javascript">

    function urlCode(cellvalue, options, rowObject) {
        cellvalue = cellvalue || '';
        cellvalue = $.trim(cellvalue);

        var url = '${basePath}/synchronousBooks/getTCbecBookEntDetail?modify=false&id=' + rowObject.id;
        return "<a class='btn-link' href=\"" + url + "\">" + "<span style='color:#00acec'>" + cellvalue + "</span></a>";
    }

    $(function () {
        $("#corptable").jqGrid({
            datatype: "json",
            url: $basePath + "/synchronousBooks/qryTCbecBookEntPage",
            colNames: [
                '索引',
                '经营单位代码',
                '经营单位名称',
                '账册编号',
                '企业内部编号',
                '账册类型',
                '录入日期',
                '申报日期',
                '结束有效期',
            ],
            colModel: [
                {name: 'indx', index: 'indx', key: true, hidden: true},
                {name: 'entCode', index: 'entCode'},
                {name: 'entName', index: 'entName'},
                {name: 'bookNo', index: 'bookNo'},
                {name: 'innerEntCode', index: 'innerEntCode'},
                {name: 'bookType', index: 'bookType'},
                {name: 'recordTime', index: 'recordTime'},
                {name: 'decTime', index: 'decTime'},
                {name: 'validTime', index: 'validTime'},
            ],
            viewrecords: true,
            autowidth: true,
            height: 'auto',
            shrinkToFit: false,
            autoScroll: true,
            rowNum: 10, //每页显示记录数
            rowList: [10, 20, 100], //可调整每页显示的记录数
            rownumWidth: 35,
            multiselect: true,
            mtype: 'POST',
            width: $('body').width(),
            pager: "#corptablePage", //分页工具栏
            loadComplete: function () {
                var rowNum = $(this).jqGrid('getGridParam', 'records');
                if (rowNum <= 0) {
                    if ($(this).parent().children('.norecords').length == 0)
                        $(this).parent().append("<div class=\"norecords\">暂无数据！</div>");
                    $(this).parent().children('.norecords').show();
                }
                else {//如果存在记录，则隐藏提示信息。
                    $(this).parent().children('.norecords').hide();
                }

                $("#corptable").setGridWidth($(window).width() - 2);
                $(".ui-jqgrid tr.ui-row-ltr td").css('text-align', 'center');
            }
        });
    });

    function reloadGrid() {
        var jsonStr = customFormToData("SearchTable");
        $("#corptable").jqGrid('setGridParam', {
            url: $basePath + "/synchronousBooks/qryTCbecBookEntPage",
            postData: JSON.parse(jsonStr), //发送数据
            mtype: 'POST',
            page: 1
        }).trigger("reloadGrid"); //重新载入
    }

    <%--$(function () {--%>
    <%--$("#btnSearch").bind("click", function () {--%>
    <%--reloadGrid();--%>
    <%--});--%>

    <%--&lt;%&ndash;$("#btnModify").bind("click", function () {&ndash;%&gt;--%>
    <%--&lt;%&ndash;var selectedIDs = $("#corptable").getGridParam("selarrrow");&ndash;%&gt;--%>
    <%--&lt;%&ndash;if (0 == selectedIDs.length) {&ndash;%&gt;--%>
    <%--&lt;%&ndash;ShowMessages("对不起,您必须先选择一条记录", "系统提示", "msgwaring", null, 0);&ndash;%&gt;--%>
    <%--&lt;%&ndash;} else {&ndash;%&gt;--%>
    <%--&lt;%&ndash;if (1 != selectedIDs.length) {&ndash;%&gt;--%>
    <%--&lt;%&ndash;ShowMessages("对不起,您只能选中一条记录", "系统提示", "msgwaring", null, 0);&ndash;%&gt;--%>
    <%--&lt;%&ndash;} else {&ndash;%&gt;--%>
    <%--&lt;%&ndash;location.href = "${basePath}/getTCbecBookEntDetail?sysId=" + selectedIDs[0];&ndash;%&gt;--%>
    <%--&lt;%&ndash;}&ndash;%&gt;--%>
    <%--&lt;%&ndash;}&ndash;%&gt;--%>
    <%--&lt;%&ndash;});&ndash;%&gt;--%>
    <%--&lt;%&ndash;$("#btnAdd").bind("click", function () {&ndash;%&gt;--%>
    <%--&lt;%&ndash;location.href = "${basePath}/getTCbecBookEntDetail?id=";&ndash;%&gt;--%>
    <%--&lt;%&ndash;});&ndash;%&gt;--%>
    <%--&lt;%&ndash;$("#btnDelete").bind("click", function () {&ndash;%&gt;--%>
    <%--&lt;%&ndash;var selectedIDs = $("#corptable").getGridParam("selarrrow");&ndash;%&gt;--%>
    <%--&lt;%&ndash;if (0 == selectedIDs.length) {&ndash;%&gt;--%>
    <%--&lt;%&ndash;ShowMessages("对不起,您必须先选择一条记录", "系统提示", "msgwaring", null, 0);&ndash;%&gt;--%>
    <%--&lt;%&ndash;} else {&ndash;%&gt;--%>
    <%--&lt;%&ndash;showConfirm("确定要删除选中的记录吗?", "系统提示", function () {&ndash;%&gt;--%>
    <%--&lt;%&ndash;$.ajax({&ndash;%&gt;--%>
    <%--&lt;%&ndash;type: "post",&ndash;%&gt;--%>
    <%--&lt;%&ndash;async: false,&ndash;%&gt;--%>
    <%--&lt;%&ndash;url: $basePath + "/deleteTCbecBookEnt",&ndash;%&gt;--%>
    <%--&lt;%&ndash;data: {sysIds: array2Str(selectedIDs)},&ndash;%&gt;--%>
    <%--&lt;%&ndash;success: function (result) {&ndash;%&gt;--%>
    <%--&lt;%&ndash;if (result) {&ndash;%&gt;--%>
    <%--&lt;%&ndash;showOKMessage('删除成功!', '', function () {&ndash;%&gt;--%>
    <%--&lt;%&ndash;reloadGrid();&ndash;%&gt;--%>
    <%--&lt;%&ndash;});&ndash;%&gt;--%>
    <%--&lt;%&ndash;} else {&ndash;%&gt;--%>
    <%--&lt;%&ndash;ShowMessages("删除失败", "系统提示", "msgwaring", null, 0);&ndash;%&gt;--%>
    <%--&lt;%&ndash;}&ndash;%&gt;--%>
    <%--&lt;%&ndash;}&ndash;%&gt;--%>
    <%--&lt;%&ndash;});&ndash;%&gt;--%>
    <%--&lt;%&ndash;})&ndash;%&gt;--%>
    <%--&lt;%&ndash;}&ndash;%&gt;--%>
    <%--&lt;%&ndash;});&ndash;%&gt;--%>

    <%--//        $("#btnReset").bind("click", function () {--%>
    <%--//            document.forms[0].reset();--%>
    <%--//        });--%>
    <%--});--%>

</script>
</body>
</html>
